<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="/public/img/favicon.ico">

    <title>笔记本</title>

    <link href="/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="/public/css/jumbotron-narrow.css" rel="stylesheet">

</head>

<body>

    <div class="container">
        <div class="header clearfix">
            <nav>
                <ul class="nav nav-pills pull-right">

                    {{ if user }}
                    <li role="presentation"><a href="/">首页</a></li>
                    <li role="presentation"><a href="/addNote">发起</a></li>
                    <li role="presentation"><a href="/about">关于</a></li>
                    <li role="presentation"><a href="#">联系</a></li>

                    {{ if user.upload==null }}
                    <li role="presentation"><img src="/public/img/user.png" width="38" height="38" alt="..."
                            class="img-circle"></li>
                    {{ else }}
                    <li role="presentation"><img src="{{ getInfo.upload }}" width="38" height="38" alt="..."
                            class="img-circle"></li>
                    {{ /if }}

                    {{ if user.userName==null }}
                    <li role="presentation"><a href="/mine">当前用户：{{ user.email }}</a></li>
                    {{ else }}
                    <li role="presentation"><a href="/edit_mina">当前用户：{{ getInfo.userName }}</a></li>
                    {{ /if }}

                    <li role="presentation" class="active"><a href="/logout">退出</a></li>
                    {{ else }}
                    <li role="presentation" class="active"><a href="/login">登录</a></li>
                    {{ /if }}

                </ul>
            </nav>
            <h3 class="text-muted">笔记列表</h3>
        </div>

        <div class="table-responsive">
            <table class="table table-hover">
                <thead>
                    <tr>
                        {{ if user }}
                        <th>标题</th>
                        <th>时间</th>
                        <th>操作</th>
                        {{ else }}
                        <th>标题</th>
                        <th>时间</th>
                        {{ /if }}
                    </tr>
                </thead>
                <tbody>
                    {{ each note }}
                    <tr>
                        {{ if user }}
                        <td>
                            <br>
                            <a href="/content?id={{ $value.ID }}">{{ $value.title }}</a>
                            <br>
                            <br>
                        </td>
                        <td>
                            <br>
                            {{ $value.create_time }}
                            <br>
                            <br>
                        </td>
                        <td>
                            <br>
                            <a href="/editNote?id={{ $value.ID }}">编辑</a>
                            <a href="/deleteNote?id={{ $value.ID }}">删除</a>
                            <br>
                            <br>
                        </td>
                        {{ else }}
                        <td><a href="#">{{ $value.title }}</a></td>
                        <td>{{ $value.create_time }}</td>
                        {{ /if }}
                    </tr>
                    {{ /each }}
                </tbody>
            </table>

            <section>
                <% for(var i=1;i<=pageNum;i++){ %>
                <span><a href="/?sum=<%= i%>"><%= i%></a></span>
                <% } %>
            </section>
        </div>

        <footer class="footer">
            <p>&copy; 2019 Company, Inc.</p>
        </footer>

    </div>
</body>

</html>